package com.kevin.spring.dto;

import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class PersonBeanTest {

	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
	}

	@Test
	public void TestBean() {
		ApplicationContext context = new ClassPathXmlApplicationContext(
				new String[] { "ApplicationContext.xml" });

		Person person = (Person) context.getBean("person");

		// Person person2 = (Person) context.getBean("person1");
		// Person person3 = (Person) context.getBean("person3");
		//
		// person3.work.sing();

		// Person person4 = (Person) context.getBean("person4");
		// System.out.println(person4.age);

		// Person person5 = (Person) context.getBean("person6");
		person.getWork().sing();
		// System.out.println(person5.getSex());

		Person person3 = new Person();
		Person[] person1 = new Person[] { person3 };
		Person[] person2 = new Person[] { person3 };

//		person1[0] = person3;
//		person2[0] = person3;

		System.out.println(person1 == person2);
		
		int[] a = {5,3,5,9,1,1};
		for(int i = 0; i < a.length - 1; i++)
		{
			for(int j = 0; j < a.length - i - 1; j++)
			{
				if(a[j] > a[j+1])
				{
					int temp = a[j];
					a[j] = a[j+1];
					a[j+1] = temp;
				}
			}
		}

		for(int i:a)
		{
			System.out.println(i);
		}
	}
}
